#include <stdio.h>

int main() {
    int a, b, c, d;
    for (a = 1; a <= 4; a++) {
        for (b = 1; b <= 4; b++) {
            if (a == b) continue;
            for (c = 1; c <= 4; c++) {
                if (c == a || c == b) continue;
                d = 10 - a - b - c;
                if (d < 1 || d > 4 || d == a || d == b || d == c) continue;
                
                int jia = (c == 1) + (a == 3);
                int yi = (b == 1) + (d == 4);
                int bing = (d == 2) + (c == 3);
                
                if (jia == 1 && yi == 1 && bing == 1) {
                    printf("%d%d%d%d\n", a, b, c, d);
                    return 0;
                }
            }
        }
    }
    return 0;
}